<template>
	<view class="page-content">
		<u-loading-page :loading="loading" bg-color="#e8e8e8"></u-loading-page>
		<u-cell-group>
			<u-cell title="统一社会信用代码" :value="detailform.taxId"></u-cell>
			<u-cell title="单位类型" :value="detailform.enterInstType"></u-cell>
			<u-cell title="单位名称" :value="detailform.enterInstName"></u-cell>
			<u-cell title="单位建立日期" :value="detailform.establishDate"></u-cell>
			<u-cell title="行政区划名称" :value="detailform.areaName"></u-cell>
			<u-cell title="单位通信详细地址" :value="detailform.instAdd"></u-cell>
			<u-cell title="法定代表人或负责人姓名" :value="detailform.principal"></u-cell>
			<u-cell title="法定代表人或负责人联系方式" :value="detailform.principalContact"></u-cell>
			<u-cell title="法定代表人或负责人证件类型" :value="detailform.principalCredType"></u-cell>
			<u-cell title="法定代表人或负责人证件号码" :value="detailform.principalCredId"></u-cell>
			<u-cell title="法人登记机关" :value="detailform.principalRegBureau"></u-cell>
			<u-cell title="法人类型" :value="detailform.principalType"></u-cell>
			<u-cell title="床位总数量" :value="detailform.totalBeds"></u-cell>
			<u-cell title="全托床位数量" :value="detailform.totalCareBeds"></u-cell>
			<u-cell title="日托床位数量" :value="detailform.dayCareBeds"></u-cell>
			<u-cell title="护理型床位数量" :value="detailform.nursingBeds"></u-cell>
			<u-cell title="建筑面积" :value="detailform.structionArea"></u-cell>
			<u-cell title="占地面积" :value="detailform.coveredArea"></u-cell>
			<u-cell title="场所性质" :value="detailform.placeProp"></u-cell>
			<u-cell title="是否通过消防部门审验合格" :value="detailform.fireQualified"></u-cell>
			<u-cell title="未通过消防部门审验合格原因" :value="detailform.fireUnqualifiedReason"></u-cell>
			<u-cell title="消防监管部门审核意见" :value="detailform.fireQualifiedComments"></u-cell>
			<u-cell title="是否取得食品生产许可证" :value="detailform.foodQualified"></u-cell>
			<u-cell title="未取得食品生产许可证原因" :value="detailform.foodUnqualifiedReason"></u-cell>
			<u-cell title="食品监管部门审核意见" :value="detailform.foodQualifiedComments"></u-cell>
			<u-cell title="单位性质一级" :value="detailform.unitPropFirst"></u-cell>
			<u-cell title="单位性质二级" :value="detailform.unitPropSecond"></u-cell>
			<u-cell title="是否为特困救助供养机构" :value="detailform.isPovertyRelief"></u-cell>
			<u-cell title="是否为光荣院" :value="detailform.isGloriousHomes"></u-cell>
			<u-cell title="是否为街道（乡镇）区域性养老服务中心" :value="detailform.isCommunityCareCenter"></u-cell>
			<u-cell title="所处位置" :value="detailform.areaType"></u-cell>
			<u-cell title="兴办主体" :value="detailform.establishMainbody"></u-cell>
			<u-cell title="是否收住能力完好类型老年人" :value="detailform.haveCapability"></u-cell>
			<u-cell title="是否收住完全失能类型老年人" :value="detailform.haveTotalDisability"></u-cell>
			<u-cell title="是否收住部分失能类型老年人" :value="detailform.haveHalfDisability"></u-cell>
			<u-cell title="是否收住特困人员类型老年人" :value="detailform.haveSpecialDifficult"></u-cell>
			<u-cell title="是否收住残疾类型老年人" :value="detailform.haveDeformity"></u-cell>
			<u-cell title="是否收住优抚类型老年人" :value="detailform.haveSpecialCare"></u-cell>
			<u-cell title="是否收住其他类型老年人" :value="detailform.haveOther"></u-cell>
			<u-cell title="其它类型老年人" :value="detailform.haveOtherName"></u-cell>
			<u-cell title="是否投保责任险" :value="detailform.isLiabilityInsurance"></u-cell>
			<u-cell title="是否长护险定点机构" :value="detailform.isLongCareInsurance"></u-cell>
			<u-cell title="是否提供居家养老上门服务" :value="detailform.isAidService"></u-cell>
			<u-cell title="家庭养老床位服务" :value="detailform.isBedAid"></u-cell>
			<u-cell title="家庭养老床位服务服务人次/月" :value="detailform.bedAidCount"></u-cell>
			<u-cell title="上门助餐服务" :value="detailform.isMealAid"></u-cell>
			<u-cell title="上门助餐服务服务人次/月" :value="detailform.mealAidCount"></u-cell>
			<u-cell title="上门助洁服务" :value="detailform.isCleanAid"></u-cell>
			<u-cell title="上门助洁服务服务人次/月" :value="detailform.cleanAidCount"></u-cell>
			<u-cell title="上门助行服务" :value="detailform.isWalkAid"></u-cell>
			<u-cell title="上门助行服务服务人次/月" :value="detailform.walkAidCount"></u-cell>
			<u-cell title="上门助浴服务" :value="detailform.isBathAid"></u-cell>
			<u-cell title="上门助浴服务服务人次/月" :value="detailform.bathAidCount"></u-cell>
			<u-cell title="上门康复" :value="detailform.isRecoverAid"></u-cell>
			<u-cell title="上门康复服务人次/月" :value="detailform.recoverAidCount"></u-cell>
			<u-cell title="上门助医服务" :value="detailform.isMedicalAid"></u-cell>
			<u-cell title="上门助医服务服务人次/月" :value="detailform.medicalAidCount"></u-cell>
			<u-cell title="巡访关爱服务" :value="detailform.isVisitAid"></u-cell>
			<u-cell title="巡访关爱服务服务人次/月" :value="detailform.visitAidCount"></u-cell>
			<u-cell title="其他上门服务" :value="detailform.isOtherAid"></u-cell>
			<u-cell title="其他上门服务服务人次/月" :value="detailform.otherAidCount"></u-cell>
			<u-cell title="是否提供社区养老服务" :value="detailform.isCommunityCare"></u-cell>
			<u-cell title="日托日间照料" :value="detailform.isDayCare"></u-cell>
			<u-cell title="日托日间照料服务人次/月" :value="detailform.dayCareCount"></u-cell>
			<u-cell title="老年餐桌食堂" :value="detailform.isElderDinning"></u-cell>
			<u-cell title="老年餐桌食堂服务人次/月" :value="detailform.elderDinningCount"></u-cell>
			<u-cell title="社区文化娱乐" :value="detailform.isEntertainment"></u-cell>
			<u-cell title="社区文化娱乐服务人次/月" :value="detailform.entertainmentCount"></u-cell>
			<u-cell title="时间银行志愿服务" :value="detailform.isTimeBank"></u-cell>
			<u-cell title="时间银行志愿服务服务人次/月" :value="detailform.timeBankCount"></u-cell>
			<u-cell title="社区康复服务" :value="detailform.isCommunityRecover"></u-cell>
			<u-cell title="社区康复服务服务人次/月" :value="detailform.communityRecoverCount"></u-cell>
			<u-cell title="其他社区养老服务" :value="detailform.isOtherService"></u-cell>
			<u-cell title="其它服务名称" :value="detailform.otherServiceName"></u-cell>
			<u-cell title="其它服务服务人次/月" :value="detailform.otherServiceCount"></u-cell>
			<u-cell title="是否开展医疗服务" :value="detailform.isMedicalService"></u-cell>
			<u-cell title="是否内设医疗机构" :value="detailform.isMedicalInst"></u-cell>
			<u-cell title="自办医院" :value="detailform.isPrivateHospital"></u-cell>
			<u-cell title="护理站" :value="detailform.isNusringStation"></u-cell>
			<u-cell title="医务室" :value="detailform.isClinic"></u-cell>
			<u-cell title="是否与医疗机构签约合作（协议医疗保障）" :value="detailform.isMedicalContracted"></u-cell>
			<u-cell title="医院" :value="detailform.isHospital"></u-cell>
			<u-cell title="乡镇卫生院" :value="detailform.isTownHospital"></u-cell>
			<u-cell title="村社区卫生服务站中心" :value="detailform.isCommunityHospital"></u-cell>
			<u-cell title="是否取得医疗机构执业许可证书" :value="detailform.isMedicalCert"></u-cell>
			<u-cell title="是否取得医疗保险定点医疗机构资格证书" :value="detailform.isMedicalInsuranceUnit"></u-cell>
			<u-cell title="是否享受政府扶持优惠政策内容" :value="detailform.isGovernAssist"></u-cell>
			<u-cell title="税收优惠政策" :value="detailform.isTaxBreak"></u-cell>
			<u-cell title="建设补贴优惠政策" :value="detailform.isConstructBreak"></u-cell>
			<u-cell title="运营补贴优惠政策" :value="detailform.isOperaBreak"></u-cell>
			<u-cell title="土地划拨优惠政策" :value="detailform.isLandBreak"></u-cell>
			<u-cell title="行政事业收费减免优惠政策" :value="detailform.isAdminBreak"></u-cell>
			<u-cell title="居民用水用电价格优惠政策" :value="detailform.isWaterElecBreak"></u-cell>
			<u-cell title="收费方式" :value="detailform.chargeType"></u-cell>
			<u-cell title="是否采用会员制方式收费" :value="detailform.isMembership"></u-cell>
			<u-cell title="护理费最低-最高" :value="detailform.nursingLow"></u-cell>
			<u-cell title="床位费最低-最高" :value="detailform.bedLow"></u-cell>
			<u-cell title="膳食费最低-最高" :value="detailform.mealLow"></u-cell>
			<u-cell title="押金/备用金最低-最高" :value="detailform.depositLow"></u-cell>
			<u-cell title="是否其他收费" :value="detailform.fireQualifiedComments"></u-cell>
			<u-cell title="其他收费名称" :value="detailform.isOtherFee"></u-cell>
			<u-cell title="其他收费最低-最高" :value="detailform.otherFeeLow"></u-cell>
			<u-cell title="月末收住老年人数" :value="detailform.totalElders"></u-cell>
			<u-cell title="机构生存状态" :value="detailform.currentStatus"></u-cell>
			<u-cell title="是否备案" :value="detailform.isRecord"></u-cell>
			<u-cell title="备案时间" :value="detailform.recordDate"></u-cell>
		</u-cell-group>
		<!-- <u-row customStyle="margin:10px">
			<u-col span="12">
				<u-button class="custom-style" @click="handel_edit_click" type="success" size="small">编辑
				</u-button>
			</u-col>
		</u-row>
		<u-row customStyle="margin:10px">
			<u-col span="12">
				<u-button class="custom-style" @click="handel_delete_click" :disabled="disabled_Delete" type="error"
					size="small">删除
				</u-button>
			</u-col>
		</u-row>
		<u-modal :show="show" :showCancelButton="true" :content='content' @confirm="handle_confirmDelete_click"
			@cancel="handle_confirmCancel_click"></u-modal> -->
	</view>
</template>

<script>
	import {
		transformPostBody,
		transformRequestURL
	} from "@/utils/requestParams.js";

	import {
		QueryEnterInstInfoList,
		getEnterInstInfo,
	} from "@/api/elder/queryEnter.js";

	export default {
		data() {
			return {
				show: false, //删除确认窗口
				content: '确认删除此条设备信息?',
				detailform: {
					searchValue: '',
					createBy: '',
					createTime: '',
					updateBy: '',
					updateTime: '',
					remark: '',
					id: '',
					taxId: '',
					enterInstType: '',
					enterInstName: '',
					establishDate: '',
					areaCode: '',
					areaName: '',
					instAdd: '',
					instLev: '',
					principal: '',
					principalContact: '',
					principalCredType: '',
					principalCredId: '',
					principalRegBureau: '',
					principalType: '',
					totalCareBeds: 104,
					dayCareBeds: 0,
					nursingBeds: 20,
					totalBeds: 104,
					structionArea: 2175,
					coveredArea: 7332,
					placeProp: '',
					fireQualified: '',
					fireUnqualifiedReason: '',
					fireQualifiedComments: '',
					foodQualified: '',
					foodUnqualifiedReason: '',
					foodQualifiedComments: '',
					unitPropFirst: '',
					unitPropSecond: '',
					isPovertyRelief: '',
					isGloriousHomes: '',
					isCommunityCareCenter: '',
					areaType: '',
					establishMainbody: '',
					haveCapability: '',
					haveTotalDisability: '',
					haveHalfDisability: '',
					haveSpecialDifficult: '',
					haveDeformity: '',
					haveSpecialCare: '',
					haveOther: '',
					haveOtherName: '',
					isLiabilityInsurance: '',
					isLongCareInsurance: '',
					isAidService: '',
					isBedAid: '',
					bedAidCount: '',
					isMealAid: '',
					mealAidCount: '',
					isCleanAid: '',
					cleanAidCount: '',
					isWalkAid: '',
					walkAidCount: '',
					isBathAid: '',
					bathAidCount: '',
					isRecoverAid: '',
					recoverAidCount: '',
					isMedicalAid: '',
					medicalAidCount: '',
					isVisitAid: '',
					visitAidCount: '',
					isOtherAid: '',
					otherAidCount: '',
					isCommunityCare: '',
					isDayCare: '',
					dayCareCount: 0,
					isElderDinning: '',
					elderDinningCount: 0,
					isEntertainment: '',
					entertainmentCount: 0,
					isTimeBank: '',
					timeBankCount: 0,
					isCommunityRecover: '',
					communityRecoverCount: 0,
					isOtherService: '',
					otherServiceName: '',
					otherServiceCount: 0,
					isMedicalService: '',
					isMedicalInst: '',
					isPrivateHospital: '',
					isNusringStation: '',
					isClinic: '',
					isMedicalContracted: '',
					isHospital: '',
					isTownHospital: '',
					isCommunityHospital: '',
					isMedicalCert: '',
					isMedicalInsuranceUnit: '',
					isGovernAssist: '',
					isTaxBreak: '',
					isConstructBreak: '',
					isOperaBreak: '',
					isLandBreak: '',
					isAdminBreak: '',
					isWaterElecBreak: '',
					chargeType: '',
					isMembership: '',
					nursingUp: 850,
					nursingLow: 175,
					bedUp: 200,
					bedLow: 200,
					mealUp: 616,
					mealLow: 600,
					depositUp: 0.01,
					depositLow: 0.01,
					isOtherFee: '',
					otherFeeName: '',
					otherFeeLow: 0,
					otherFeeUp: '',
					totalElders: 28,
					currentStatus: '',
					isRecord: '',
					recordDate: '',
					lng: '',
					lat: '',
					delFlag: '',
				},
				loading: false, //加载中
				id: null,
			}
		},
		onLoad: function(options) {
			console.log('options', options.id)
			this.id = options.id
		},
		onShow() {
			this.getList();
		},
		computed: {
			disabled_Delete() {
				return !this.$auth.hasRole("admin")
			},
			getAddress() {
				return function(item) {
					let result = "";
					if (item.city) result += item.city
					if (item.district) result += item.district
					if (item.town) result += item.town
					if (item.village) result += item.village
					if (item.street) result += item.street
					return result
				}
			},
			getDetailAddress() {
				return function(item) {
					let result = "";
					if (item.roomNum) result += item.roomNum
					if (item.residenceAdd) result += item.residenceAdd
					return result
				}
			},
		},
		methods: {
			getList() {
				this.loading = true;
				getEnterInstInfo(this.id).then((response) => {
					this.loading = false;
					console.log("getEnterInstInfo", response.data);
					this.detailform = response.data
					console.log("detailform", this.detailform);
				});
			},
			handel_edit_click() {
				this.$tab.navigateTo('/pages/DeviceInstall/edit?id=' + this.id)
			},
			//删除设备信息
			handel_delete_click() {
				this.show = true;
			},
			handle_confirmDelete_click() {
				this.loading = true;
				delDeviceInstall([this.id]).then((response) => {
					uni.$u.toast('删除成功')
					this.loading = false;
					console.log("delDeviceInstall", response);
					this.show = false;
					this.$tab.navigateBack();
				}).catch(errors => {
					console.log("errors", errors, this.id);
					uni.$u.toast('删除失败')
				});
			},
			handle_confirmCancel_click() {
				this.show = false;
			}
		},
	}
</script>

<style lang="scss">
	page {
		background-color: white;
		display: flex;
		justify-content: center;
	}

	.page-content {
		width: 93%;
	}

	.custom-style {
		width: 80%;
		font-weight: bolder;
		font-size: 17px;
	}
</style>
